home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CDPD Public Domain Collection for CDTV 4
/
CDPD_IV.bin
/
e
/
mailinglists
/
amigae.0793july.archive
/
000023_crash!minyos.xx….OZ.AU!s924723_Mon, 12 Jul 93 05:41:08 PST.msg
< prev
next >
Wrap
Internet Message Format
|
1994-05-26
|
3KB
Received: by bkhouse.cts.com (V1.16/Amiga)
id AA00000; Mon, 12 Jul 93 05:41:08 PST
Received: from peladon.rmit.OZ.AU by crash.cts.com with smtp
(Smail3.1.28.1 #15) id m0oFN78-00007WC; Mon, 12 Jul 93 05:36 PDT
Received: from minyos.xx.rmit.OZ.AU by peladon.rmit.OZ.AU with SMTP id AA19977
(5.65c/IDA-1.4.4 for <amigae@bkhouse.cts.com>); Mon, 12 Jul 1993 22:36:05 +1000
Received: by minyos.xx.rmit.OZ.AU
Date: Mon, 12 Jul 93 22:35:50 EST
Message-Id: <9307121235.21423@minyos.xx.rmit.OZ.AU>
From: s924723@minyos.xx.rmit.OZ.AU (Son Huu Le)
To: amigae@bkhouse.cts.com
Subject: Optimising_E
(Profiler output and drool deleted :)
Boyerm.e probably suffered from a low buffer size input, which reminds me,
what are the proper arguments for the DOS function SetVBuf()? The DOS
manual says it accepts 4 arguments, E only accepts 3!?
Okay, so the boyerm.e example wasn't a very good as it relied on DOS calls,
but I still say E is slower and would benefit from a good optimizer. While
I was debugging my programs, I noticed that E always(?) used MOVE.L x(A5),D0
for variable storage/retrieval. In a tight loop, a MOVE.L x(AN),D0
will cost more cycle time than a MOVE.L D1,D0. Since E doesn't touch the
other data registers often, it would help speed time greatly if you could
use them.
For a better example(?) I coded the following short |ittle program, which is
small and relies on no external calls (except for outputting of result at
the end which btw, if left out under SAS/C, makes the program run under
1 sec - clever optimiser :)
E:
PROC main()
DEF x=0, y=0
WHILE x<500000
x++
y:=y+x
ENDWHILE
WriteF('\d\n',y)
ENDPROC
Disassembly of main loop:
loop:
MOVE.L -4(A5),D0
CMPI.L #500000,D0
BGE out
MOVE.L -4(A5),D0 ; What's this for?! (;
ADDQ.L #1,-4(A5)
MOVE.L -8(A5),D0
ADD.L -4(A5),D0
MOVE.L D0,-8(A5)
BRA loop
C:
#include <stdio.h>
void main()
{
int x=0, y=0; /* Direct port - bare minimum change */
while (x<500000) {
x++;
y=y+x;
}
printf("%d\n",y);
}
Disassembly of main loop:
loop:
ADDQ.L #1,D7
ADD.L D7,D6 ; SAS/C might be expensive, but look at this!
CMPI.L #500000,D7
BLT.S loop
Time results:
~~~~~~~~~~~~
(On an Amiga 2000 with 2mb fast, 1mb chip)
(Faster machines might need to alter the counter for meaningful results)
11.STAT-RAM:> timex test_c
446198416
Ticks:429 -> Secs:8.58 -> Time:0h0m8s
11.STAT-RAM:> timex test_e
446198416
Ticks:1224 -> Secs:24.48 -> Time:0h0m24s
Although I don't expect E to outperform a commercial C product, using
spare data registers would increase E's performance tremendously.
One last suggestion.. how about making some E functions (such as WriteF)
more assembling friendly, so you can use certain E functions in the middle
of an assembly code? ie. it uses only the upper data/address registers (4-7)
and leaves the lower ones intact.
Regards..
Son Le
PS. Wouter, your address <Wouter@alf.let.uva.nl> bounced.